<template>
  <t-dialog
    :header="header"
    placement="center"
    :visible.sync="visible"
    :onClose="closeDialog"
    width="80%"
    top="48px"
    :closeOnEscKeydown="false"
    :closeOnOverlayClick="false"
    :footer="edit"
  >
    <template #footer>
      <t-button :loading="btnLoading" theme="success" @click="onSubmit(0)">暂存</t-button>
      <!-- <t-tooltip content="提交后不可再编辑会进入审批流程"> -->
        <t-button :loading="btnLoading" :disabled="isCommit"  theme="primary" @click="onSubmit(1)">提交</t-button>
      <!-- </t-tooltip> -->
    </template>
    <t-loading :text="formLoadingText" size="medium" :loading="formLoading" showOverlay>
      <template #indicator>
        <t-icon v-if="formLoadingText === '数据读取中...'" name="loading" slot="icon"/>
        <t-icon v-else name="error-circle-filled" slot="icon"/>
      </template>
      <t-form
        labelAlign="left"
        :data="formData"
        ref="form"
        labelWidth="0.3px"
        :colon="true"
        :rules="edit ? rules : {}"
      >
        <t-row><b>一、标准制（修）订</b></t-row>
        <t-card hover-shadow v-for="(info, index) in formData.standardsInfos" :key="info.tid">
          <t-row justify="space-between">
            <t-col :span="4">
              <t-form-item label="序号" :name="`standardsInfos[${index}].sort`" :label-width="60">
                <t-input-number v-if="edit" v-model="info.sort"  placeholder="请输入序号" style="width: 90%" />
                <span v-else>{{info.sort}}</span>
              </t-form-item>
            </t-col>
            <t-col :span="4" style="padding-right: 10px">
              <t-form-item label="标准编号" :name="`standardsInfos[${index}].num`" :label-width="90">
                <t-input v-if="edit" v-model="info.num" placeholder="请输入标准编号"></t-input>
                <span v-else>{{info.num}}</span>
              </t-form-item>
            </t-col>
            <t-col :span="4">
              <t-form-item label="指标名称" :name="`standardsInfos[${index}].name`" :label-width="90">
                <t-input v-if="edit" v-model="info.name" placeholder="请输入指标名称"></t-input>
                <span v-else>{{info.name}}</span>
              </t-form-item>
            </t-col>
          </t-row>
          <t-row>
            <t-col :span="4" style="padding-right: 10px">
              <t-form-item label="发布/管理单位" :name="`standardsInfos[${index}].releaseName`" :label-width="120">
                <t-input v-if="edit" v-model="info.releaseName" placeholder="请输入发布/管理单位"></t-input>
                <span v-else>{{info.releaseName}}</span>
              </t-form-item>
            </t-col>
            <t-col :span="4" style="padding-right: 10px">
              <t-form-item label="状态" :name="`standardsInfos[${index}].releaseStatus`" :label-width="60">
                <t-select v-if="edit" v-model="info.releaseStatus" :options="dict.type.release_status" placeholder="请选择状态" />
                <span v-else>{{info.releaseStatus|filterByDict(dict.type.release_status)}}</span>
              </t-form-item>
            </t-col>
            <t-col :span="4">
              <t-form-item label="等级" :name="`standardsInfos[${index}].releaseLevel`" :label-width="60">
                <t-select v-if="edit" v-model="info.releaseLevel" :options="dict.type.release_level" placeholder="请选择等级" />
                <span v-else>{{info.releaseLevel|filterByDict(dict.type.release_level)}}</span>
              </t-form-item>
            </t-col>
          </t-row>
          <t-row>
            <t-col :span="4" style="padding-right: 10px">
              <t-form-item label="运输方式" :name="`standardsInfos[${index}].transportType`" :label-width="90">
                <t-select v-if="edit" v-model="info.transportType" :options="dict.type.transport_type" placeholder="请选择运输方式" />
                <span v-else>{{info.transportType|filterByDict(dict.type.transport_type)}}</span>
              </t-form-item>
            </t-col>
            <t-col :span="4" style="padding-right: 10px">
              <t-form-item label="标准类别" :name="`standardsInfos[${index}].standarType`" :label-width="90">
                <t-select v-if="edit" v-model="info.standarType" :options="dict.type.standar_type" placeholder="请选择标准类别" />
                <span v-else>{{info.standarType|filterByDict(dict.type.standar_type)}}</span>
              </t-form-item>
            </t-col>
            <t-col :span="4">
              <t-form-item label="发布日期" :name="`standardsInfos[${index}].releaseDate`" :label-width="90">
                <t-date-picker v-if="edit" v-model="info.releaseDate" placeholder="请选择发布日期" />
                <span v-else>{{info.releaseDate}}</span>
              </t-form-item>
            </t-col>
          </t-row>
          <t-row>
            <t-col :span="4">
              <t-form-item label="实施日期" :name="`standardsInfos[${index}].implDate`" :label-width="90">
                <t-date-picker v-if="edit" v-model="info.implDate" placeholder="请选择实施日期" />
                <span v-else>{{info.implDate}}</span>
              </t-form-item>
            </t-col>
            <t-col :span="4">
              <t-form-item label="废止日期" :name="`standardsInfos[${index}].abolishDate`" :label-width="90">
                <t-date-picker v-if="edit" v-model="info.abolishDate" placeholder="请选择废止日期" />
                <span v-else>{{info.abolishDate}}</span>
              </t-form-item>
            </t-col>
            <t-col :span="1" :offset="3">
              <t-button v-if="edit" variant="dashed" theme="danger" @click="delLineOne(index)">删除此行</t-button>
            </t-col>
          </t-row>
        </t-card>
        <t-card hover-shadow v-if="edit">
          <t-button variant="dashed" theme="primary" @click="addLineOne">
            <t-icon name="add" slot="icon" />
            添加一行
          </t-button>
        </t-card>
        <t-row><b>二、标准宣贯会议情况</b></t-row>
        <t-card hover-shadow v-for="(info, index) in formData.standardsMeetInfos" :key="info.tid">
          <t-row>
            <t-col :span="3">
              <t-form-item label="序号" :name="`standardsMeetInfos[${index}].sort`" :label-width="60">
                <t-input-number v-if="edit" v-model="info.sort"  placeholder="请输入序号" style="width: 90%" />
                <span v-else>{{info.sort}}</span>
              </t-form-item>
            </t-col>
            <t-col :span="5" style="padding-right: 10px">
              <t-form-item label="会议名称" :name="`standardsMeetInfos[${index}].name`" :label-width="90">
                <t-input v-if="edit" v-model="info.name" placeholder="请输入会议名称"></t-input>
                <span v-else>{{info.name}}</span>
              </t-form-item>
            </t-col>
            <t-col :span="4">
              <t-form-item label="主办单位" :name="`standardsMeetInfos[${index}].hostName`" :label-width="90">
                <t-input v-if="edit" v-model="info.hostName" placeholder="请输入主办单位"></t-input>
                <span v-else>{{info.hostName}}</span>
              </t-form-item>
            </t-col>
          </t-row>
          <t-row>
            <t-col :span="4" style="padding-right: 10px">
              <t-form-item label="宣贯内容" :name="`standardsMeetInfos[${index}].content`" :label-width="90">
                <t-select v-if="edit" v-model="info.content" :options="xgContentOptions" placeholder="请选择宣贯内容" />
                <span v-else>{{info.content}}</span>
              </t-form-item>
            </t-col>
            <t-col :span="4">
              <t-form-item label="宣贯人次" :name="`standardsMeetInfos[${index}].personCount`" :label-width="90">
                <t-input-adornment v-if="edit" append="人次">
                  <t-input-number v-if="edit" v-model="info.personCount"  placeholder="请输入宣贯人次" theme="normal" />
                </t-input-adornment>
                <span v-else>{{info.personCount}} 人次</span>
              </t-form-item>
            </t-col>
            <t-col :span="1" :offset="3">
              <t-button v-if="edit" variant="dashed" theme="danger" @click="delLineTwo(index)">删除此行</t-button>
            </t-col>
          </t-row>
        </t-card>
        <t-card hover-shadow v-if="edit">
          <t-button variant="dashed" theme="primary" @click="addLineTwo">
            <t-icon name="add" slot="icon" />
            添加一行
          </t-button>
        </t-card>
        <t-row><b>三、标准化经费投入情况</b></t-row>
        <t-row>
          <t-form-item label="标准化经费总投入" name="bzhjfztr" :label-width="140">
            <t-input-adornment v-if="edit" append="万元">
              <t-input-number v-model="formData.bzhjfztr"  placeholder="请输入标准化经费总投入" theme="normal" />
            </t-input-adornment>
            <span v-else>{{formData.bzhjfztr}} 万元</span>
          </t-form-item>
        </t-row>
        <t-row>
          <span class="front-title">标准化经费总投入中</span>
          <t-form-item label="政府拨款" name="zfbk" :label-width="labelWidth">
            <t-input-adornment v-if="edit" append="万元">
              <t-input-number v-model="formData.zfbk"  placeholder="请输入政府拨款" theme="normal" />
            </t-input-adornment>
            <span v-else>{{formData.zfbk}} 万元</span>
          </t-form-item>
          <t-form-item label="企业投入" name="qytr" :label-width="labelWidth">
            <t-input-adornment v-if="edit" append="万元">
              <t-input-number v-model="formData.qytr"  placeholder="请输入企业投入" theme="normal" />
            </t-input-adornment>
            <span v-else>{{formData.qytr}} 万元</span>
          </t-form-item>
          <t-form-item label="其他来源" name="qtly" :label-width="labelWidth">
            <t-input-adornment v-if="edit" append="万元">
              <t-input-number v-model="formData.qtly"  placeholder="请输入其他来源" theme="normal" />
            </t-input-adornment>
            <span v-else>{{formData.qtly}} 万元</span>
          </t-form-item>
        </t-row>
        <t-row>
          <t-col :span="3">
            <b>四、标准国际化</b>
          </t-col>
          <t-col :span="3">
            <span class="col-header">国际标准化组织（ISO）</span>
          </t-col>
          <t-col :span="3">
            <span class="col-header">国际电工委员会（IEC）</span>
          </t-col>
          <t-col :span="3">
            <span class="col-header">其他国际机构</span>
          </t-col>
        </t-row>
        <t-row>
          <t-col :span="3">
            <span class="front-title">年度提交国际标准项目提案数量</span>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="ndtjgjbzxmtasliso">
              <t-input-adornment v-if="edit" append="个">
                <t-input-number v-model="formData.ndtjgjbzxmtasliso"  placeholder="请输入国际标准化组织个数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.ndtjgjbzxmtasliso}} 个</span>
            </t-form-item>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="ndtjgjbzxmtasliec">
              <t-input-adornment v-if="edit" append="个">
                <t-input-number v-model="formData.ndtjgjbzxmtasliec"  placeholder="请输入国际电工委员会个数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.ndtjgjbzxmtasliec}} 个</span>
            </t-form-item>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="ndtjgjbzxmtaslqt">
              <t-input-adornment v-if="edit" append="个">
                <t-input-number v-model="formData.ndtjgjbzxmtaslqt"  placeholder="请输入其他国际机构个数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.ndtjgjbzxmtaslqt}} 个</span>
            </t-form-item>
          </t-col>
        </t-row>
        <t-row>
          <t-col :span="3">
            <span class="front-title">制定中的国际标准草案数量</span>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="zdzgjbzcasliso">
              <t-input-adornment v-if="edit" append="个">
                <t-input-number v-model="formData.zdzgjbzcasliso"  placeholder="请输入国际标准化组织个数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.zdzgjbzcasliso}} 个</span>
            </t-form-item>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="zdzgjbzcasliec">
              <t-input-adornment v-if="edit" append="个">
                <t-input-number v-model="formData.zdzgjbzcasliec"  placeholder="请输入国际电工委员会个数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.zdzgjbzcasliec}} 个</span>
            </t-form-item>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="zdzgjbzcaslqt">
              <t-input-adornment v-if="edit" append="个">
                <t-input-number v-model="formData.zdzgjbzcaslqt"  placeholder="请输入其他国际机构个数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.zdzgjbzcaslqt}} 个</span>
            </t-form-item>
          </t-col>
        </t-row>
        <t-row>
          <t-col :span="3">
            <span class="front-title">年度发布国际标准数量</span>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="ndfbgjbzhsliso">
              <t-input-adornment v-if="edit" append="个">
                <t-input-number v-model="formData.ndfbgjbzhsliso"  placeholder="请输入国际标准化组织个数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.ndfbgjbzhsliso}} 个</span>
            </t-form-item>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="ndfbgjbzhsliec">
              <t-input-adornment v-if="edit" append="个">
                <t-input-number v-model="formData.ndfbgjbzhsliec"  placeholder="请输入国际电工委员会个数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.ndfbgjbzhsliec}} 个</span>
            </t-form-item>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="ndfbgjbzhslqt">
              <t-input-adornment v-if="edit" append="个">
                <t-input-number v-model="formData.ndfbgjbzhslqt"  placeholder="请输入其他国际机构个数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.ndfbgjbzhslqt}} 个</span>
            </t-form-item>
          </t-col>
        </t-row>
        <t-row>
          <t-col :span="3">
            <span class="front-title">累计发布国际标准数量</span>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="ljfbgjbzhsliso">
              <t-input-adornment v-if="edit" append="个">
                <t-input-number v-model="formData.ljfbgjbzhsliso"  placeholder="请输入国际标准化组织个数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.ljfbgjbzhsliso}} 个</span>
            </t-form-item>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="ljfbgjbzhsliec">
              <t-input-adornment v-if="edit" append="个">
                <t-input-number v-model="formData.ljfbgjbzhsliec"  placeholder="请输入国际电工委员会个数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.ljfbgjbzhsliec}} 个</span>
            </t-form-item>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="ljfbgjbzhslqt">
              <t-input-adornment v-if="edit" append="个">
                <t-input-number v-model="formData.ljfbgjbzhslqt"  placeholder="请输入其他国际机构个数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.ljfbgjbzhslqt}} 个</span>
            </t-form-item>
          </t-col>
        </t-row>
        <t-row>
          <t-col :span="3">
            <span class="front-title">国际标准应投票数</span>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="gjbzytpsiso">
              <t-input-adornment v-if="edit" append="票">
                <t-input-number v-model="formData.gjbzytpsiso"  placeholder="请输入国际标准化组织票数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.gjbzytpsiso}} 票</span>
            </t-form-item>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="gjbzytpsiec">
              <t-input-adornment v-if="edit" append="票">
                <t-input-number v-model="formData.gjbzytpsiec"  placeholder="请输入国际电工委员会票数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.gjbzytpsiec}} 票</span>
            </t-form-item>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="gjbzytpsqt">
              <t-input-adornment v-if="edit" append="票">
                <t-input-number v-model="formData.gjbzytpsqt"  placeholder="请输入其他国际机构票数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.gjbzytpsqt}} 票</span>
            </t-form-item>
          </t-col>
        </t-row>
        <t-row>
          <t-col :span="3">
            <span class="front-title">国际标准实投票数</span>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="gjbzstpsiso">
              <t-input-adornment v-if="edit" append="票">
                <t-input-number v-model="formData.gjbzstpsiso"  placeholder="请输入国际标准化组织票数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.gjbzstpsiso}} 票</span>
            </t-form-item>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="gjbzstpsiec">
              <t-input-adornment v-if="edit" append="票">
                <t-input-number v-model="formData.gjbzstpsiec"  placeholder="请输入国际电工委员会票数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.gjbzstpsiec}} 票</span>
            </t-form-item>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="gjbzstpsqt">
              <t-input-adornment v-if="edit" append="票">
                <t-input-number v-model="formData.gjbzstpsqt"  placeholder="请输入其他国际机构" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.gjbzstpsqt}} 票</span>
            </t-form-item>
          </t-col>
        </t-row>
        <t-row align="middle">
          <t-col :span="3">
            <t-row align="middle">
              <t-col :span="8">
                <div class="front-title" style="line-height: 104px">国际标准本年注册专家</div>
              </t-col>
              <t-col :span="4">
                <div style="line-height: 32px;margin-bottom: 20px;">专家组</div>
                <div style="line-height: 32px;">工作组数</div>
              </t-col>
            </t-row>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="gjbzbnzczjsiso" style="margin-bottom: 20px;">
              <t-input-adornment v-if="edit" append="人">
                <t-input-number v-model="formData.gjbzbnzczjsiso"  placeholder="请输入国际标准化组织人数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.gjbzbnzczjsiso}} 人</span>
            </t-form-item>
            <t-form-item label="" name="gjbzbnzcgzzsiso">
              <t-input-adornment v-if="edit" append="组">
                <t-input-number v-model="formData.gjbzbnzcgzzsiso"  placeholder="请输入国际标准化组织组数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.gjbzbnzcgzzsiso}} 组</span>
            </t-form-item>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="gjbzbnzczjsiec" style="margin-bottom: 20px;">
              <t-input-adornment v-if="edit" append="人">
                <t-input-number v-model="formData.gjbzbnzczjsiec"  placeholder="请输入国际电工委员会人数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.gjbzbnzczjsiec}} 人</span>
            </t-form-item>
            <t-form-item label="" name="gjbzbnzcgzzsiec">
              <t-input-adornment v-if="edit" append="组">
                <t-input-number v-model="formData.gjbzbnzcgzzsiec"  placeholder="请输入国际电工委员会组数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.gjbzbnzcgzzsiec}} 组</span>
            </t-form-item>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="gjbzbnzczjsqt" style="margin-bottom: 20px;">
              <t-input-adornment v-if="edit" append="人">
                <t-input-number v-model="formData.gjbzbnzczjsqt"  placeholder="请输入其他国际组织人数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.gjbzbnzczjsqt}} 人</span>
            </t-form-item>
            <t-form-item label="" name="gjbzbnzcgzzsqt">
              <t-input-adornment v-if="edit" append="组">
                <t-input-number v-model="formData.gjbzbnzcgzzsqt"  placeholder="请输入其他国际组织组数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.gjbzbnzcgzzsqt}} 组</span>
            </t-form-item>
          </t-col>
        </t-row>
        <t-row align="middle">
          <t-col :span="3">
            <t-row align="middle">
              <t-col :span="8">
                <div class="front-title" style="line-height: 104px">国际标准期末有效注册专家</div>
              </t-col>
              <t-col :span="4">
                <div style="line-height: 32px;margin-bottom: 20px;">专家组</div>
                <div style="line-height: 32px;">工作组数</div>
              </t-col>
            </t-row>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="gjbzwyxzczjsiso" style="margin-bottom: 20px;">
              <t-input-adornment v-if="edit" append="人">
                <t-input-number v-model="formData.gjbzwyxzczjsiso"  placeholder="请输入国际标准化组织人数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.gjbzwyxzczjsiso}} 人</span>
            </t-form-item>
            <t-form-item label="" name="gjbzwyxzcgzzsiso">
              <t-input-adornment v-if="edit" append="组">
                <t-input-number v-model="formData.gjbzwyxzcgzzsiso"  placeholder="请输入国际标准化组织组数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.gjbzwyxzcgzzsiso}} 组</span>
            </t-form-item>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="gjbzwyxzczjsiec" style="margin-bottom: 20px;">
              <t-input-adornment v-if="edit" append="人">
                <t-input-number v-model="formData.gjbzwyxzczjsiec"  placeholder="请输入国际电工委员会人数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.gjbzwyxzczjsiec}} 人</span>
            </t-form-item>
            <t-form-item label="" name="gjbzwyxzcgzzsiec">
              <t-input-adornment v-if="edit" append="组">
                <t-input-number v-model="formData.gjbzwyxzcgzzsiec"  placeholder="请输入国际电工委员会组数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.gjbzwyxzcgzzsiec}} 组</span>
            </t-form-item>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="gjbzwyxzczjsqt" style="margin-bottom: 20px;">
              <t-input-adornment v-if="edit" append="人">
                <t-input-number v-model="formData.gjbzwyxzczjsqt"  placeholder="请输入其他国际组织人数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.gjbzwyxzczjsqt}} 人</span>
            </t-form-item>
            <t-form-item label="" name="gjbzwyxzcgzzsqt">
              <t-input-adornment v-if="edit" append="组">
                <t-input-number v-model="formData.gjbzwyxzcgzzsqt"  placeholder="请输入其他国际组织组数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.gjbzwyxzcgzzsqt}} 组</span>
            </t-form-item>
          </t-col>
        </t-row>
        <t-row align="middle">
          <t-col :span="3">
            <t-row align="middle">
              <div class="front-title" style="line-height: 104px">参加国际标准化会议</div>
            </t-row>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="cjgjbzhhiiso" style="margin-bottom: 20px;">
              <t-input-adornment v-if="edit" append="次">
                <t-input-number v-model="formData.cjgjbzhhiiso"  placeholder="请输入国际标准化组织次数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.cjgjbzhhiiso}} 次</span>
            </t-form-item>
            <t-form-item label="" name="cjgjbzhhirsiso">
              <t-input-adornment v-if="edit" append="人次">
                <t-input-number v-model="formData.cjgjbzhhirsiso"  placeholder="请输入国际标准化组织人次数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.cjgjbzhhirsiso}} 人次</span>
            </t-form-item>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="cjgjbzhhiiec" style="margin-bottom: 20px;">
              <t-input-adornment v-if="edit" append="次">
                <t-input-number v-model="formData.cjgjbzhhiiec"  placeholder="请输入国际标准化组织次数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.cjgjbzhhiiec}} 次</span>
            </t-form-item>
            <t-form-item label="" name="cjgjbzhhirsiec">
              <t-input-adornment v-if="edit" append="人次">
                <t-input-number v-model="formData.cjgjbzhhirsiec"  placeholder="请输入国际标准化组织人次数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.cjgjbzhhirsiec}} 人次</span>
            </t-form-item>
          </t-col>
          <t-col :span="3">
            <t-form-item label="" name="cjgjbzhhiqt" style="margin-bottom: 20px;">
              <t-input-adornment v-if="edit" append="次">
                <t-input-number v-model="formData.cjgjbzhhiqt"  placeholder="请输入国际标准化组织次数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.cjgjbzhhiqt}} 次</span>
            </t-form-item>
            <t-form-item label="" name="cjgjbzhhirsqt">
              <t-input-adornment v-if="edit" append="人次">
                <t-input-number v-model="formData.cjgjbzhhirsqt"  placeholder="请输入国际标准化组织人次数" theme="normal" />
              </t-input-adornment>
              <span v-else>{{formData.cjgjbzhhirsqt}} 人次</span>
            </t-form-item>
          </t-col>
        </t-row>
      </t-form>
    </t-loading>
  </t-dialog>
</template>

<script>
export default {
  name: 'TabKeyLaboratoryForm',
  props: {
    edit: { type: Boolean, default: true },
    infoId: { type: Number, default: -1 }
  },
  dicts: ['release_status', 'release_level', 'transport_type', 'standar_type'],
  data() {
    return {
      visible: true,
      btnLoading: false,
      formLoading: true,
      formLoadingText: '数据读取中...',
      header: '',
      formData: {
        bzhjfztr: undefined,
        zfbk: undefined,
        qytr: undefined,
        qtly: undefined,
        ndtjgjbzxmtasliso: undefined,
        ndtjgjbzxmtasliec: undefined,
        ndtjgjbzxmtaslqt: undefined,
        zdzgjbzcasliso: undefined,
        zdzgjbzcasliec: undefined,
        zdzgjbzcaslqt: undefined,
        ndfbgjbzhsliso: undefined,
        ndfbgjbzhsliec: undefined,
        ndfbgjbzhslqt: undefined,
        ljfbgjbzhsliso: undefined,
        ljfbgjbzhsliec: undefined,
        ljfbgjbzhslqt: undefined,
        gjbzytpsiso: undefined,
        gjbzytpsiec: undefined,
        gjbzytpsqt: undefined,
        gjbzstpsiso: undefined,
        gjbzstpsiec: undefined,
        gjbzstpsqt: undefined,
        gjbzbnzczjsiso: undefined,
        gjbzbnzczjsiec: undefined,
        gjbzbnzczjsqt: undefined,
        gjbzbnzcgzzsiso: undefined,
        gjbzbnzcgzzsiec: undefined,
        gjbzbnzcgzzsqt: undefined,
        gjbzwyxzczjsiso: undefined,
        gjbzwyxzczjsiec: undefined,
        gjbzwyxzczjsqt: undefined,
        gjbzwyxzcgzzsiso: undefined,
        gjbzwyxzcgzzsiec: undefined,
        gjbzwyxzcgzzsqt: undefined,
        cjgjbzhhiiso: undefined,
        cjgjbzhhiiec: undefined,
        cjgjbzhhiqt: undefined,
        cjgjbzhhirsiso: undefined,
        cjgjbzhhirsiec: undefined,
        cjgjbzhhirsqt: undefined,
        standardsInfos: [],
        standardsMeetInfos: [],
        approveStatus: '1',
      },
      rules: {
        bzhjfztr: [{ required: true, message: '标准化经费总投入不能为空' }],
        zfbk: [{ required: true, message: '政府拨款不能为空' }],
        qytr: [{ required: true, message: '企业投入不能为空' }],
        qtly: [{ required: true, message: '其他来源不能为空' }],
        ndtjgjbzxmtasliso: [{ required: true, message: '年度提交国际标准项目提案-国际标准化组织个数不能为空' }],
        ndtjgjbzxmtasliec: [{ required: true, message: '年度提交国际标准项目提案-国际电工委员会个数不能为空' }],
        ndtjgjbzxmtaslqt: [{ required: true, message: '年度提交国际标准项目提案-其他国际机构个数不能为空' }],
        zdzgjbzcasliso: [{ required: true, message: '制定中的国际标准草案-国际标准化组织个数不能为空' }],
        zdzgjbzcasliec: [{ required: true, message: '制定中的国际标准草案-国际电工委员会个数不能为空' }],
        zdzgjbzcaslqt: [{ required: true, message: '制定中的国际标准草案-其他国际机构个数不能为空' }],
        ndfbgjbzhsliso: [{ required: true, message: '年度发布国际标准-国际标准化组织个数不能为空' }],
        ndfbgjbzhsliec: [{ required: true, message: '年度发布国际标准-国际电工委员会个数不能为空' }],
        ndfbgjbzhslqt: [{ required: true, message: '年度发布国际标准-其他国际机构个数不能为空' }],
        ljfbgjbzhsliso: [{ required: true, message: '累计发布国际标准-国际标准化组织个数不能为空' }],
        ljfbgjbzhsliec: [{ required: true, message: '累计发布国际标准-国际电工委员会个数不能为空' }],
        ljfbgjbzhslqt: [{ required: true, message: '累计发布国际标准-其他国际机构个数不能为空' }],
        gjbzytpsiso: [{ required: true, message: '国际标准应投票-国际标准化组织票数不能为空' }],
        gjbzytpsiec: [{ required: true, message: '国际标准应投票-国际电工委员会票数不能为空' }],
        gjbzytpsqt: [{ required: true, message: '国际标准应投票-其他国际机构票数不能为空' }],
        gjbzstpsiso: [{ required: true, message: '国际标准实投票-国际标准化组织票数不能为空' }],
        gjbzstpsiec: [{ required: true, message: '国际标准实投票-国际电工委员会票数不能为空' }],
        gjbzstpsqt: [{ required: true, message: '国际标准实投票-其他国际机构票数不能为空' }],
        gjbzbnzczjsiso: [{ required: true, message: '国际标准本年注册专家-专家组-国际标准化组织人数不能为空' }],
        gjbzbnzczjsiec: [{ required: true, message: '国际标准本年注册专家-专家组-国际电工委员会人数不能为空' }],
        gjbzbnzczjsqt: [{ required: true, message: '国际标准本年注册专家-专家组-其他国际组织人数不能为空' }],
        gjbzbnzcgzzsiso: [{ required: true, message: '国际标准本年注册专家-工作组数-国际标准化组织人数不能为空' }],
        gjbzbnzcgzzsiec: [{ required: true, message: '国际标准本年注册专家-工作组数-国际电工委员会人数不能为空' }],
        gjbzbnzcgzzsqt: [{ required: true, message: '国际标准本年注册专家-工作组数-其他国际组织人数不能为空' }],
        gjbzwyxzczjsiso: [{ required: true, message: '国际标准期末有效注册专家-专家组-国际标准化组织人数不能为空' }],
        gjbzwyxzczjsiec: [{ required: true, message: '国际标准期末有效注册专家-专家组-国际电工委员会人数不能为空' }],
        gjbzwyxzczjsqt: [{ required: true, message: '国际标准期末有效注册专家-专家组-其他国际组织人数不能为空' }],
        gjbzwyxzcgzzsiso: [{ required: true, message: '国际标准期末有效注册专家-工作组数-国际标准化组织人数不能为空' }],
        gjbzwyxzcgzzsiec: [{ required: true, message: '国际标准期末有效注册专家-工作组数-国际电工委员会人数不能为空' }],
        gjbzwyxzcgzzsqt: [{ required: true, message: '国际标准期末有效注册专家-工作组数-其他国际组织人数不能为空' }],
        cjgjbzhhiiso: [{ required: true, message: '参加国际标准化会议-国际标准化组织次数不能为空' }],
        cjgjbzhhiiec: [{ required: true, message: '参加国际标准化会议-国际电工委员会次数不能为空' }],
        cjgjbzhhiqt: [{ required: true, message: '参加国际标准化会议-其他国际组织次数不能为空' }],
        cjgjbzhhirsiso: [{ required: true, message: '参加国际标准化会议-国际标准化组织人次数不能为空' }],
        cjgjbzhhirsiec: [{ required: true, message: '参加国际标准化会议-国际电工委员会人次数不能为空' }],
        cjgjbzhhirsqt: [{ required: true, message: '参加国际标准化会议-其他国际组织人次数不能为空' }],
        // list
        ryzs: [{ required: true, message: '不能为空' }],
        sort: [{ required: true, message: '序号不能为空' }],
        num: [{ required: true, message: '不能为空' }],
        name: [{ required: true, message: '名称不能为空' }],
        releaseName: [{ required: true, message: '不能为空' }],
        releaseStatus: [{ required: true, message: '不能为空' }],
        releaseLevel: [{ required: true, message: '不能为空' }],
        transportType: [{ required: true, message: '不能为空' }],
        standarType: [{ required: true, message: '不能为空' }],
        releaseDate: [{ required: true, message: '不能为空' }],
        implDate: [{ required: true, message: '不能为空' }],
        abolishDate: [{ required: true, message: '不能为空' }],
        hostName: [{ required: true, message: '主办单位不能为空' }],
        content: [{ required: true, message: '宣贯内容不能为空' }],
        personCount: [{ required: true, message: '宣贯人次不能为空' }],
      },
      xgContentOptions: [
        { value: '1', label: '标准宣贯' },
        { value: '2', label: '计量检定规程宣贯' },
        { value: '3', label: '标准化政策宣贯' },
      ]
    }
  },
  computed: {
    isCommit() {
      return this.formData.approveStatus !== '1'
    },
    labelWidth() {
      return '90px'
    }
  },
  created() {
    if (this.edit) {
      if (this.infoId === -1) {
        this.header = '添加信息记录'
        this.formLoading = false
      } else {
        this.header = '修改信息内容'
        this.getDetail()
      }
    } else if (this.infoId === -1) {
      this.header = '信息错误！！！'
      this.formLoadingText = '信息错误，请联系管理员'
    } else {
      this.header = '查看信息内容'
      this.getDetail()
    }
  },
  methods: {
    // 查看和修改时获取详情
    getDetail() {
      this.$api.kjtjdc.table.standardizedInfo.getInfoById(this.infoId).then(({data}) => {
        this.formData = data;
        this.formLoading = false
      }).catch(e => {
        this.formLoadingText = e
        this.$message.error('数据获取失败，请稍后再试！')
      });
    },
    async onSubmit(isCommit) {
      this.btnLoading = true
      let validRes
      try {
        validRes = await this.$refs.form.validate()
      // eslint-disable-next-line no-empty
      } catch (e) {}
      if (validRes !== true) {
        this.$message.warning('请完善表单')
        this.btnLoading = false
        return
      }
      let action = 'edit'
      if (this.infoId === -1) {
        // 新增
        action = 'add'
      }
      if (isCommit) {
        // 提交
        this.formData.approveStatus = '2'
      } else {
        // 暂存
        this.formData.approveStatus = '1'
      }
      this.$api.kjtjdc.table.standardizedInfo[action](this.formData).then(() => {
        this.$message.success(`${isCommit?'提交':'暂存'}信息成功！`)
        this.btnLoading = false
        this.$emit('update:visible', false);
        this.$emit('reload');
      }).catch(e => {
        this.$message.error(e)
        this.btnLoading = false
      })
    },
    closeDialog() {
      this.$refs.form.reset();
      this.$emit('update:visible', false);
    },
    addLineOne() {
      const tid = Math.random().toString(32).substring(2, 7)
      this.formData.standardsInfos.push({tid})
    },
    delLineOne(idx) {
      this.formData.standardsInfos.splice(idx, 1)
    },
    addLineTwo() {
      const tid = Math.random().toString(32).substring(2, 7)
      this.formData.standardsMeetInfos.push({tid})
    },
    delLineTwo(idx) {
      this.formData.standardsMeetInfos.splice(idx, 1)
    }
  }
};
</script>

<style lang="less" scoped>
.t-form {
  max-height: 70vh;
  overflow: auto;
  padding: 5px 10px 8px 0;
}
.t-form::-webkit-scrollbar {
    width: 7px;
    background: rgb(0 0 0 / 1%);
}
.t-form::-webkit-scrollbar-thumb {
    border-radius: 6px;
    border: 4px solid rgb(0 0 0 / 10%);
    background-clip: content-box;
    background-color: rgb(0 0 0 / 10%);
}
.t-form__item {
  margin: 0 35px 0 0;
}
.t-row {
  margin-bottom: 20px;
}
.t-row:last-of-type {
  margin-bottom: 0;
}
.front-title {
  line-height: 32px;
  margin-right: 20px;
}
.t-card {
  margin-bottom: 10px;
}
.col-header {
  color: #666;
  padding-left: 24px;
}
.t-form__item > .t-form__controls > .t-form__controls-content > span:last-of-type {
  color: red;
  text-align: center;
  display: inline-block;
}
</style>
